1. Field
The present embodiments relate generally to semiconductor processors and, in particular, to recording software control flow information in processors.
2. Background
Many software tools could benefit from receiving information about the control flow of a piece of code. For example, control flow information can include information that describes the order in which program instructions have been executed. Control flow information can also include a listing of control transfers, such as information on where a branch instruction came from and where the branch jumped to.
Software development tools, such as debuggers, implement backtrace capabilities that can provide a programmer with a listing of the instructions and functions that led to the current point of code execution. The development tools could benefit from control flow information. Other examples of software benefitting from control flow information include software that records the execution of a program for later replay and software that engages in re-execution of code in environments such as simulators. Additionally, certain types of programs or processes, such as kernel processes or thread management libraries, may need to dynamically access the value of the previous program counter, but accessing this information can be complicated using existing solutions. Control flow information can assist in this operation.
Recording this control flow information can be a slow and laborious process. For example, software-based implementations that record every branch and return address may cause significant runtime overheads. Other hardware-based mechanisms for recording branch addresses are not optimized for runtime execution or are only available in kernel-mode operation.